import { ApiProperty } from '@nestjs/swagger';

export class AnthropicErrorDto {
  @ApiProperty({ 
    enum: [
      'invalid_request_error',
      'authentication_error', 
      'permission_error',
      'not_found_error',
      'rate_limit_error',
      'api_error'
    ],
    description: 'Type of error'
  })
  type: 'invalid_request_error' | 'authentication_error' | 'permission_error' | 'not_found_error' | 'rate_limit_error' | 'api_error';

  @ApiProperty({ description: 'Human-readable error message' })
  message: string;
}

export class AnthropicErrorResponseDto {
  @ApiProperty({ enum: ['error'], description: 'Response type' })
  type: 'error';

  @ApiProperty({ type: AnthropicErrorDto, description: 'Error details' })
  error: AnthropicErrorDto;
}

// 用于日志记录的请求日志 DTO
export class RequestLogDto {
  @ApiProperty({ description: 'Request ID' })
  id: string;

  @ApiProperty({ description: 'Request timestamp' })
  timestamp: string;

  @ApiProperty({ description: 'HTTP method' })
  method: string;

  @ApiProperty({ description: 'Request path' })
  path: string;

  @ApiProperty({ description: 'Request headers' })
  headers: Record<string, string>;

  @ApiProperty({ description: 'Request body', required: false })
  body?: any;

  @ApiProperty({ description: 'Query parameters', required: false })
  query?: Record<string, string>;

  @ApiProperty({ description: 'Client IP address' })
  ip: string;

  @ApiProperty({ description: 'User agent', required: false })
  userAgent?: string;

  @ApiProperty({ description: 'Response status code', required: false })
  responseStatus?: number;

  @ApiProperty({ description: 'Response time in milliseconds', required: false })
  responseTime?: number;

  @ApiProperty({ description: 'API key used (masked)', required: false })
  apiKey?: string;
}